<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script>
	// 种类格式
	$.extend($.fn.validatebox.defaults.rules, {
        shopCheck: {
            validator: function(value){
                var return_flag;
                //alert(decToHex(value));
                var dateone = '{"value":"'+ decToHex(value) +'"}';
                var dataOneJson =JSON.parse(dateone);

                 $.ajax({
                    async : false,
                    url : "<c:url value='/shop/checkShop.do'/>",
                    type : "post",
                    data: $.param(dataOneJson),
                    success : function(data) {
                        var dataLeft = data;
                        if (typeof (dataLeft) == 'string' && dataLeft != '') {
                            dataLeft = JSON.parse(dataLeft);
                        }
                        if(dataLeft.success){
                            return_flag= true;
                        }else{
                            return_flag= false;
                        }
                    }
                }); 
                 return return_flag;
            },
            message: '系统已存在该商店名！'
        }
    });
    
    $.extend($.fn.validatebox.defaults.rules, {
        twst: {
            validator: function(value){
                var return_flag;
                 $.ajax({
                    async : false,
                    url : "<c:url value='/user/checkUserName.do'/>"+"?value="+value,
                    type : "post",
                    success : function(data) {
                        var dataLeft = data;
                        if (typeof (dataLeft) == 'string' && dataLeft != '') {
                            dataLeft = JSON.parse(dataLeft);
                        }
                        if(dataLeft.success){
                            return_flag= true;
                        }else{
                            return_flag= false;
                        }
                    }
                }); 
                 return return_flag;
            },
            message: '系统已存在该用户名！'
        }
    });
    
    $.extend($.fn.validatebox.defaults.rules, {
        phoneCheck : {
            validator: function(value){
                var return_flag;
                 $.ajax({
                    async : false,
                    url : "<c:url value='/user/checkPhone.do'/>"+"?value="+value,
                    type : "post",
                    success : function(data) {
                        var dataLeft = data;
                        if (typeof (dataLeft) == 'string' && dataLeft != '') {
                            dataLeft = JSON.parse(dataLeft);
                        }
                        if(dataLeft.success){
                            return_flag= true;
                        }else{
                            return_flag= false;
                        }
                    }
                }); 
                 return return_flag;
            },
            message: '系统已存在该电话号码！'
        }
    });
</script>
</head>
<body>
</body>
</html>